<template>
  <div class="dashboard-container">
    <!-- <div class="dashboard-text">name: {{ name }}</div> -->
    <!-- <div class="dashboard-text">token: {{ token }}</div> -->
    <div class="logo">
      <!-- <img src="./assets/logo.png" alt="logo"> -->
    </div>
      <!-- <a href="https://github.com/login/oauth/authorize?client_id=88f028142403410abfef&redirect_uri=http://127.0.0.1:8888/dashboard">github</a> -->
      <!-- <a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd4a837c38b866355&redirect_uri=http://127.0.0.1:8888/dashboard&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect">微信</a> -->
      <!-- <a href=" https://open.weixin.qq.com/connect/qrconnect?appid=wxd4a837c38b866355&redirect_uri=http://127.0.0.1:8001&response_type=code&scope=snsapi_login&state=123#wechat_redirect">微信</a> -->
    <a @click="getUserInvitCode">点击获取邀请码</a>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import {getUserInvitCode} from '@/api/mall/pc-web/user'
// import {gitHubLogin} from '@/api/news/pc-web/user'
export default {
  name: 'Dashboard',
  components: {},
  computed: {
    ...mapGetters([
      'nickname',
      'token'
    ])
  },
  created() {
    // this.$message('这是一条消息提示');
  },
  async mounted() {
    // console.log(window.location.href.indexOf("code=") !==-1);判断是否否找到code=
    if(window.location.href.indexOf("code=") == -1){
        }else{
           const code = window.location.href.split('?code=')[1]
           console.log(code);
          // var Code=str.substr();
          // const res = await GetLogin({code:Code})
          // console.log(res);
        }
  },
  methods: {
    async getUserInvitCode(){
      const code = await getUserInvitCode()
      const origin = window.location.origin
      const href =  origin+'/register'+code;
      console.log(href);
    }
  },
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
